package stsj.meddroid.elements;

public class Time {
	private long startTime;
	private long nowTime;
	private int second;
	private int minute;
	
	public Time(int m, int s){
		startTime = System.currentTimeMillis();
		nowTime = startTime;
		second = s;
		minute = m;
	}
	
	public void runTime(){
		if (!(second == 0 && minute == 0)){
			nowTime = System.currentTimeMillis();
			if (nowTime > startTime+1000){
				if(second == 0){second = 59; minute--;}
				else{second--;}
				startTime=nowTime;
			}
		}
	}
	
	public int getSecond(){
		return second;
	}

	public int getMinute(){
		return minute;
	}
	
	public long getNow(){
		return nowTime;
	}
	
	public void setSecond(int x){
		second = x;
	}
	
	public void setMinute(int x){
		minute = x;
	}
}
